using NHibernate;
using Web.DataAccess.Factories;
using Web.Entities.Enums;

namespace Web.HelperClasses.Inflexion
{
	public class SQLInflector : IInflector
	{
		public string Inflect(string normalForm, Case c, bool singular)
		{
			var inflectedForm = queryFactory.Create(normalForm, singular, c).Load(session);
			return inflectedForm ?? "";
		}
		
		public SQLInflector(ISession session, IInflectionQueryFactory queryFactory)
		{
			this.session = session;
			this.queryFactory = queryFactory;
		}

		private readonly ISession session;
		private readonly IInflectionQueryFactory queryFactory;
	}
}